package it.enricod.jcontextfree.gui.paint;

import it.enricod.jcontextfree.engine.model.FigureEnum;
import it.enricod.jcontextfree.engine.model.IFigure;
import it.enricod.jcontextfree.gui.paint.java2d.CircleFigurePainter;
import it.enricod.jcontextfree.gui.paint.java2d.Java2DPainter;
import it.enricod.jcontextfree.gui.paint.java2d.SquareFigurePainter;

public class PainterFactory
{

	public static IPainter createJava2DPainter()
	{
		return new Java2DPainter();
	}

	public static IFigurePainter getPainter(IFigure figure)
	{
		if (figure.getType().equals(FigureEnum.CIRCLE))
		{
			return new CircleFigurePainter(figure);
		} else if (figure.getType().equals(FigureEnum.SQUARE))
		{
			return new SquareFigurePainter(figure);
		}

		throw new IllegalArgumentException("shape unknown");
	}
}
